#--------------------------------------------------------
# VisualK-OS                                             
#    Module: GamePad Mapping Display Screen class [v1.0] 
#    Author: Kevin Slaughter                             
#--------------------------------------------------------

"""
[Revision History]
    v1.0: Initial implementation... Having the screens encapsulated by
            the ScreenManager class with if-then-else blocks worked at
            first, when not much as required of the program, but more
            complex classes arose out of necessity to shrink/simplify
            the growing source code.
"""

import globals
from VKCC_Constants import *


class cScreenDisplayMapping(object):
    ### General properties
    color = 2                   # Color theme used within this screen
    title = "Gamepad Mapping"   # Title to be displayed
    hasExit = True              # Flag: Display exit option
    
    
    ### handleKey(): Handle any passed keyboard input independent of GP usage.
    def handleKey(self, c, scr):
        if (c == KEY_0): scr.changeScreen(SCREEN_MAIN)	# 0 = Back to main menu
        return
    
    
    ### paint(): Draw any elements used on this screen.
    def paint(self, scr):
        scr.menuPrep(self)
        
        # Display button labels
        scr.printText(10,5,"[Shoulder Buttons]", T_ERROR)
        scr.printText(21,2,"Select: ")
        scr.printText(21,3," Start: ")
        scr.printText(3,9,  "L1:");     scr.printText(32,9, "R1:")
        scr.printText(3,6,  "L2:");     scr.printText(32,6, "R2:")
        scr.printText(16,20,"L3:");     scr.printText(27,20,"R3:")
        scr.printText(9,12, "[Up]")
        scr.printText(8,18, "[Down]")
        scr.printText(3,15, "[Left]")
        scr.printText(14,15,"[Right]")
        scr.printText(29,12,"[Triangle]")
        scr.printText(32,18,"[X]")
        scr.printText(24,15,"[Square]")
        scr.printText(36,15,"[Circle]")
        
        # Initialize label strings
        aStart = "";      aSelect = "";      aL3 = "";      aR3 = ""
        aUp = "";         aDown = "";        aRight = "";   aLeft = ""
        aTriangle = "";   aCircle = "";      aX = "";       aSquare = ""
        aL1 = "";         aL2 = "";          aR1 = "";      aR2 = ""
        
        # Populate button label data
        if (globals.GP.curMap == 0):    ### Map #0; Full Board Colors
            aSelect = "Next mapping profile"
            aStart = "Toggle momentary lighting"
            aUp = "B0: Green";       aDown = "B0: Red"
            aLeft = "B0: Blue";      aRight = "B0: Orange"
            aTriangle = "B1: Green"; aX = "B1: Red"
            aSquare = "B1: Blue";    aCircle = "B1: Orange"
            aL1 = "B0: Yellow";      aR1 = "B1: Yellow"
            aL3 = "B0: Purple";      aR2 = "B1: Purple"
            aL3 = "B0: White";       aR3 = "B1: White"
        
        # Display button labels
        return
    